package com.example.venue_reservation_service.mapper;

import com.example.venue_reservation_service.domain.Device;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 31586
* @description 针对表【venue_device】的数据库操作Mapper
* @createDate 2025-06-29 14:38:46
* @Entity generator.domain.Device
*/
@Mapper
public interface DeviceMapper extends BaseMapper<Device> {

    @Select("SELECT * FROM venue_device ORDER BY timestamp DESC LIMIT #{limit}")
    List<Device> selectLatestDevices(@Param("limit") int limit);

    @Delete("DELETE FROM venue_device ORDER BY timestamp ASC LIMIT #{count}")
    void deleteOldestRecords(@Param("count") int count);

}




